Disk Usage (Boabab)
   HOME

TheInfoList



OR:

du (abbreviated from ''disk usage'') is a standard
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
program Program, programme, programmer, or programming may refer to: Business and management * Program management, the process of managing several related projects * Time management * Program, a part of planning Arts and entertainment Audio * Progra ...
used to estimate file space usage—space used under a particular
directory Directory may refer to: * Directory (computing), or folder, a file system structure in which to store computer files * Directory (OpenVMS command) * Directory service, a software application for organizing information about a computer network's u ...
or files on a
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
. A
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
commandline version of this program is part of
Sysinternals suite Windows Sysinternals is a website that offers technical resources and utilities to manage, diagnose, troubleshoot, and monitor a Microsoft Windows environment. Originally, the Sysinternals website (formerly known as ntinternals) was created in 1 ...
by
Mark Russinovich Mark Eugene Russinovich (born December 22, 1966) is a Spanish-born American software engineer and author who serves as CTO of Microsoft Azure. He was a cofounder of software producers Winternals before it was acquired by Microsoft in 2006. Ea ...
.


History

The du utility first appeared in version 1 of
AT&T UNIX The history of Unix dates back to the mid-1960s, when the Massachusetts Institute of Technology, AT&T Bell Labs, and General Electric were jointly developing an experimental time-sharing operating system called Multics for the GE-645 mainframe. M ...
. The version of du bundled in
GNU GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
coreutils The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were cr ...
was written by Torbjorn Granlund, David MacKenzie, Paul Eggert, and Jim Meyering. The command is also available for
FreeDOS FreeDOS (formerly Free-DOS and PD-DOS) is a free software operating system for IBM PC compatible computers. It intends to provide a complete MS-DOS-compatible environment for running Legacy system, legacy software and supporting embedded system ...
.


Specification

By default, the Single UNIX Specification (SUS) specifies that du is to display the file space allocated to each file and directory contained in the current directory. Links will be displayed as the size of the link file, not what is being linked to; the size of the content of directories is displayed, as expected. As du reports allocation space and not absolute file space, the amount of space on a file system shown by du may vary from that shown by df if files have been deleted but their blocks not yet freed. Also the minfree setting that allocates datablocks for the filesystem and the super user processes creates a discrepancy between total blocks and the sum of used and available blocks. The minfree setting is usually set to about 5% of the total filesystem size. For more info se
core utils faq


Usage

du takes a single argument, specifying a pathname for to work; if it is not specified, the current directory is used. The SUS mandates for the following options: * , In addition to the default output, include information for each non-directory entry * , display a grand total of the disk usage found by the other arguments * , the depth at which summing should occur. -d 0 sums at the current level, -d 1 sums at the subdirectory, -d 2 at sub-subdirectories, etc. * , calculate disk usage for link references specified on the command line * , show sizes as multiples of 1024
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
s, not 512-byte * , calculate disk usage for link references anywhere * , report only the sum of the usage in the current directory, not for each directory therein contained * , only traverse files and directories on the device on which the pathname argument is specified. Other Unix and Unix-like operating systems may add extra options. For example, BSD and GNU du specify a option, displaying disk usage in a format easier to read by the user, adding units with the appropriate
SI prefix The International System of Units, known by the international abbreviation SI in all languages and sometimes pleonastically as the SI system, is the modern form of the metric system and the world's most widely used system of measurement. E ...
(e.g. 10 MB).


Examples

Sum of directories (-s) in
kilobyte The kilobyte is a multiple of the unit byte for digital information. The International System of Units (SI) defines the prefix ''kilo'' as 1000 (103); per this definition, one kilobyte is 1000 bytes.International Standard IEC 80000-13 Quantiti ...
s (-k): $ du -sk * 152304 directoryOne 1856548 directoryTwo Sum of directories (-s) in
human-readable A human-readable medium or human-readable format is any encoding of data or information that can be naturally read by humans. In computing, ''human-readable'' data is often encoded as ASCII or Unicode text, rather than as binary data. In most c ...
format (-h : Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte): $ du -sh * 149M directoryOne 1.8G directoryTwo disk usage of all subdirectories and files including hidden files within the current directory (sorted by filesize) : $ du -sk . . *, sort -n disk usage of all subdirectories and files including hidden files within the current directory (sorted by reverse filesize) : $ du -sk . . *, sort -nr The weight (size) of each subdirectory under the current directory (-d 1) with a sum total at the end (-c) all displayed in human-readable format (-h): $ du -d 1 -c -h or with du from GNU: $ du --max-depth=1 -c -h The weight (size) of subdirectories under the root directory (-d 1, trailing /) with a sum total at the end (-c), all displayed in human-readable format (-h) without traversing into other filesystems (-x). Useful when /var /tmp or other directories are on separate storage from the root directory: $ du -d 1 -c -h -x / or with du from GNU: $ du --max-depth=1 -c -h -x /


See also

*
List of Unix commands This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems. List See also * List of G ...
*
Filelight Filelight is a graphical disk usage analyzer part of the KDE Applications, KDE Gear. Instead of showing a tree view of the files within a Disk partitioning, partition or directory (computing), directory, or even a columns-represent-directories v ...
*
Disk Usage Analyzer Disk Usage Analyzer is a graphical disk usage analyzer for GNOME. It was part of GNOME Core Applications, but was split off for GNOME 3.4. It was originally named Baobab after the ''Adansonia'' tree. The software gives the user a menu-driven, gr ...
*
ncdu ncdu (NCurses, NCurses Disk Usage) is a disk utility for Unix systems. Its name refers to its similar purpose to the du (Unix), du utility, but ncdu uses a text-based user interface under the urses programming library. Users can navigate the l ...


References


External links

* * {{Core Utilities commands Standard Unix programs Unix SUS2008 utilities Plan 9 commands Inferno (operating system) commands Disk usage analysis software Unix file system-related software